package DAO;

import hibernate.HibernateUtil;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;

import clases.Visita;

public class VisitaDAO {
	
	SessionFactory factory;
	
	public VisitaDAO(){
		
		factory= HibernateUtil.getSessionFactory();
	}
	
	public void saveOrUpdate(Visita vis) {
		
		Session session=factory.openSession();
		Transaction tx=session.beginTransaction();
		session.saveOrUpdate(vis);
		tx.commit();
		session.close();
	}
	
	
	public void delete(Visita vis) {
		Session session=factory.openSession();
		Transaction tx=session.beginTransaction();
		session.delete(vis);
		tx.commit();
		session.close();
	}
	

}
